#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <string.h>

int main(int argc, char** argv)
{
	int fd, status;

	// 用法示例：./My_Button_test /dev/my_button@0
	if(argc != 2)
	{
		printf("Too few or too many arguments!\n");
		printf("Usage : %s <dev>\n", argv[0]);
		return -1;
	}

	fd = open(argv[1], O_RDWR);
	if(fd < 0)
	{
		printf("Cannot open file %s\n", argv[1]);
		return -1;
	}

	read(fd, &status, 1);
	printf("Get button : %d\n", status);

	close(fd);

	return 0;
}


